package com.itheima.config;

import com.itheima.filter.GrayFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.gateway.config.LoadBalancerProperties;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*****
 * @Author:
 * @Description:加载配置
 ****/
@Configuration
public class GrayBalanceConfig {

    /****
     * 过滤器配置
     */
    @Bean
    @ConditionalOnMissingBean({GrayFilter.class})
    public GrayFilter grayFilter(LoadBalancerClientFactory clientFactory, LoadBalancerProperties properties) {
        return new GrayFilter(clientFactory, properties);
    }
}
